#{extends 'main.html'/}
<div class="l-clear"></div>
<div id="maingrid" style="margin:0; padding:0;">
</div>

<style>
<!--
element.style {
    height: auto;
}
.l-grid-header .l-grid-header2{
	height: 90px;
}
-->
</style>
<script type="text/javascript">

    $(function () {
    	var grid;
    	//建设规模
    	var columns1=[
    	              {display: '变电容量(MVA)', name: 'capacity', width:50, type: 'String' },
    	              {display: '线路长度(km)', name: 'lineLength', width:50, type: 'String' },
    	              {display: '总投资(万元)', name: 'countInvest', width:50, type: 'String' }];
    	//累计完成情况
    	var columns2=[
    	              {display: '投资(万元)', name: 'totalInvest', width:40, type: 'String' },
    	              {display: '项目数(项)', name: 'itemTotal', width:50, type: 'String' }];
    	//本月完成投资
    	var columns4=[
					{ display: '总额', name: 'totalAmount', width:50, type: 'String' },
					{ display: '土建', name: 'civil', width:50, type: 'String' },
					{ display: '设备', name: 'equipment', width:50, type: 'String' },
					{ display: '安装', name: 'erect', width:50, type: 'String' },
					{ display: '线路', name: 'line', width:50, type: 'String' },
					{ display: '其他', name: 'other', width:50, type: 'String' }
    	              ]
    	var columns3=[
    	              {display: '工程完成	', name: 'proCompleted', width:150,
    	            	  columns:columns4}
    	              ];
    	
    	//工程形象进度
    	var columns5 = [
						{ display: '本月完成进度', name: 'pvrQuanlity', width:150, type: 'String',align:'left'  },
						{ display: '累计完成进度', name: 'pvrTotal', width:150, type: 'String',align:'left'  }
    	               ]
    	

        function f_initGrid() 
        {
         	grid = $("#maingrid").ligerGrid({
            columns: [
				{ display: 'id', name: 'id', width:100, hide: true},
	            { display: '项目名称', name: 'projectName', width:100, type: 'String' },
	            { display: '所属月份', name: 'belongDate', width: 80, type: 'string' },
	            { display: '建 设 规 模', name: 'projectScale',columns:columns1, width:150},
	            { display: '累计完成情况', name: 'completed',columns:columns2, width:100},
	            { display: '本月完成投资(万元)', name: 'monthInvest',columns:columns3, width:300},
	            { display: '工程形象进度', name: 'pvSchedule',columns:columns5, width:300},
	            { display: '本月工程质量事故', name: 'qualityAccident', width: 100, type: 'string' },
	            { display: '本月工程安全事故', name: 'securityAccident', width: 100, type: 'string' },
	            {display:'工程形象建设信息', name:'pvrJsonInfo',hide:true},
	            { display: '备注', name: 'remark', width: 120, type: 'string', type: 'textarea'},
	            { display: '审核状态', name: 'verifyStateStr', width:120}
            ],
            url:"/verifyCPJson",
            method: "GET",
            pageSize: 20,                      
            width: 1600,
            enabledSort:false,
            rownumbers:false,
            height:470,
            rowHeight:"auto",
            toolbar: { items: [
                { text: '通过审核', click: verifyYes, icon: 'ok' },
                { line: true },
                { text: '不能通过', click: verifyNo, icon: 'delete' }
                ] }
        	});         	
        }
        
        f_initGrid();
        
        //审核通过
        function verifyYes(){
        	var selected = grid.getSelected();
            if (!selected) { LG.tip('请选择行!'); return }
            verify({id:selected.id,pass:true});
        }
        //审核不通过
        function verifyNo(){
        	var selected = grid.getSelected();
            if (!selected) { LG.tip('请选择行!'); return }
            verify({id:selected.id,pass:false});
        }
        //审核处理
        function verify(param){
       	 $.ajax({
             loading: '处理中...',
             type: 'POST',
             url: "/constructP/verifyOperate",                  
             data: param,
             success: function (data)
             {
            	 grid.loadData(true);
                 LG.tip(data);
             },
             error: function (data)
             {
                 LG.tip(data);
             }
         });
        }
	})

</script>




